<extend name="Public/layout"/>
<block name="head">
    <link rel="stylesheet" href="__PUBLIC__css/n_person_index.css?A=<php>echo time()</php>">
    <link rel="stylesheet" href="__PUBLIC__css/net-loan.css?A=<php>echo time()</php>">
    <style type="text/css">
        body {
                background: #f4f5fa !important;
        }
    </style>
    <script src="__PUBLIC__js/util.js"></script>
    <script>
        (function (window) {
            var docEl = document.documentElement;
            var h;

            function setUnitA() {
                window.rem = docEl.getBoundingClientRect().width / 10;
                docEl.style.fontSize = window.rem + 'px';
            }

            window.addEventListener('resize', function () {
                clearTimeout(h);
                h = setTimeout(function () {
                    setUnitA();
                }, 300);
            }, false);

            window.addEventListener('pageshow', function (e) {
                if (e.persisted) {
                    clearTimeout(h);
                    h = setTimeout(function () {
                        setUnitA();
                    }, 300);
                }
            }, false);

            setUnitA();

        })(window);
    </script>
</block>

<block name="main">

        <div class="header">
          <div class="user_info">
            <div class="head-img"  onclick="changeAvatar()">
              <img id="uploadPreview"  src="{$user_info.url_img}" width='100%' height="100%">
              <input id="uploadImage" type="file" onchange="loadImageFile()" style="display: none;">
            </div>
            <div class="info_data">
                <h4><span>{$user_info.nickname}</span> <!--<img src="__PUBLIC__images/ad-star.png">--></h4>
                <span class="icon_num">8号金币：{$user_info.score}个</span>
            </div>
            <div class="seting" onclick="location.href='/Home/Person/setting'"></div>
          </div>
        </div>

        <div class="menu">
          <ul>
            <li  onclick="location.href='/Home/Person/cash/val/1'"  </li>
                <div class="menu_list_img"><img src="__PUBLIC__images/icon_wd_yue_nor.png"></div> 
                <div class="menu_content"> <span>账户余额（提现点这里）</span><img class="more" src="__PUBLIC__images/icon_wd_r_nor.png"> <div class="f_content">{$user_info.balance}元</div></div>
            </li>
            <li>
              <div class="menu_list_img"><img src="__PUBLIC__images/icon_wd_touzi_nor.png"></div> 
              <div onclick="location.href='/Home/Person/invest_index'" class="menu_content"> <span>我的投资详情</span><img class="more" src="__PUBLIC__images/icon_wd_r_nor.png"></div>
            </li>
            <li>
              <div class="menu_list_img"><img src="__PUBLIC__images/icon_wd_quanzi_nor.png"></div> 
              <div onclick="location.href='/Home/Person/my_circle'" class="menu_content"> <span>我加入的圈子</span><img class="more" src="__PUBLIC__images/icon_wd_r_nor.png"> <div class="f_content"><!-- 新动态299条 --></div></div>
            </li>
            <li onclick="location.href='/Home/Person/trade_details'" >
              <div class="menu_list_img"><img src="__PUBLIC__images/icon_wd_mingxi_nor.png"></div> 
              <div class="menu_content no_border"> <span>交易明细</span><img class="more" src="__PUBLIC__images/icon_wd_r_nor.png"></div>
            </li>
          </ul>
        </div>



        <div class="menu">
          <ul>
            <if condition="$user_info['referral'] gt 0">
            <li>
              <div class="menu_list_img"><img src="__PUBLIC__images/icon_wd_gz_nor.png"></div> 
              <div class="menu_content"  onclick="location.href='/Home/Person/center/id/{$user_info[referral]}'" > <span>我的师傅</span><img class="more" src="__PUBLIC__images/icon_wd_r_nor.png"> <div class="f_content"><!-- 新动态299条 --></div></div>
            </li>
            </if>
            <li>
              <div class="menu_list_img"><img src="__PUBLIC__images/icon_wd_guandian_nor.png"></div> 
              <div onclick="location.href='/Home/Person/viewpoint'"  class="menu_content no_border"> <span>我发表的观点</span><img class="more" src="__PUBLIC__images/icon_wd_r_nor.png"></div>
            </li>

          </ul>
        </div>


</block>
<block name="js">
    <script type="text/javascript">

        //    修改头像功能
        var oFReader = new FileReader();
        var rFilter = /^(?:image\/bmp|image\/cis\-cod|image\/gif|image\/ief|image\/jpeg|image\/jpeg|image\/jpeg|image\/pipeg|image\/png|image\/svg\+xml|image\/tiff|image\/x\-cmu\-raster|image\/x\-cmx|image\/x\-icon|image\/x\-portable\-anymap|image\/x\-portable\-bitmap|image\/x\-portable\-graymap|image\/x\-portable\-pixmap|image\/x\-rgb|image\/x\-xbitmap|image\/x\-xpixmap|image\/x\-xwindowdump)$/i;

        oFReader.onload = function (oFREvent) {
            document.getElementById("uploadPreview").src = oFREvent.target.result;
            $.post('/Home/Person/change_head_pic',{
                file:oFREvent.target.result
            },function(res){
                if(res.errorCode==1) {
                    layer.open({
                        content: res.msg
                        , skin: 'msg'
                        , time: 1
                    });
                }
            })
        };

        function loadImageFile() {
            if (document.getElementById("uploadImage").files.length === 0) { return; }
            var oFile = document.getElementById("uploadImage").files[0];
            if (!rFilter.test(oFile.type)) { alert("You must select a valid image file!"); return; }
            oFReader.readAsDataURL(oFile);
        }

        function changeAvatar() {

//        底部对话框
            layer.open({
                content: ''
                ,className: 'avatar-layer'
                ,btn: ['取消', '从相册选择']
                ,skin: 'footer'
                ,no: function () {
                    $('#uploadImage').click()
                    layer.closeAll()
                }
                ,yes: function(index){
                    layer.close(index);
                }
            });
        }


        function no_bank_card() {
            layer.open({
                content: "您还未绑定银行卡,请先绑定银行卡！"
                , btn: ['前往', '取消']
                , yes: function (index) {
                    location.href = "/Home/Person/bind_bank_card"
                }
            });
        }

            var title="{$user_info.nickname}的个人主页-8号金融街！"
            var desc = '8号金融街精选多家优质平台，稳健赚利息还有首投红包领！'
            var link="http://wei.8hjie.com/Home/Person/center/id/{$user_info.id}"
            var imgUrl='http://wei.8hjie.com/App/Home/Public/images/chat-icon.png' 

    </script>
</block>